package com.d0323;

import java.io.*;

public class ByteArrayBufferTest {
    public static void main(String[] args) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(baos);
        try {
            dos.writeInt(100);
            dos.writeUTF("icss");
            dos.writeDouble(3.14);
            dos.close();
            baos.close();
            byte[] buf = baos.toByteArray();

            ByteArrayInputStream bais = new ByteArrayInputStream(buf);
            DataInputStream dis = new DataInputStream(bais);
            System.out.println(dis.readInt()+"\t"+dis.readUTF()+"\t"+dis.readDouble());
            dis.close();
            bais.close();
        } catch (IOException e) {
            e.printStackTrace();
        }




    }
}
